
<%
	String status = "";
	if (request.getSession().getAttribute("status") != null) {
		status = (String) request.getSession().getAttribute("status");
	} else if (!status.equals("ingelogd")) {
		response.sendRedirect("index.jsp?message=Log+eerst+in+om+verder+te+gaan");
	}
	//session.removeAttribute("status");
%>
<%@page import="model.*"%>
<%@page import="model.GenodigdenIO"%>
<%@page import="domein.*"%>
<%
	String eventNaam = "";
	String plaats = "";
	String Titel = "";
	String contactpersoon = "";
	String Organisator = "";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Incentro Event Inviting System</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico" />
</head>

<body>

	<div id="wrapper">

		<div id="header">
			<a href="eOverzicht.jsp" id="logo"><img src="img/logo.png" /></a>
		</div>

		<h3>Status evenement</h3>

		<%
			String eventID = request.getParameter("eventID");
		%>

		<div id="search-form">

			<a href="eOverzicht.jsp"><input type="submit" value="Terug"
				class="terugButton" /></a>

			<form method="post" action="status.jsp?eventID=<%out.print(eventID);%>">
				<input type="submit" value="Search" />
				<input type="text" id="searchField" name="id" placeholder="Search"></input>
			</form>
		</div>


		<table class="table" summary="Evenementen overzicht">
			<thead>
				<tr>
					<th scope="col">Genodigde</th>
					<th scope="col">Contactpersoon</th>
					<th scope="col">email</th>
					<th scope="col">telefoonnr</th>
					<th scope="col">Status</th>
				</tr>
			</thead>
			<tbody>
				<%
					int counter = 1;
					String a = "1";

					if (request.getParameter("id") != null) {

						String value = request.getParameter("id");
						GenodigdenIO gIo = new GenodigdenIO();

						for (Genodigden g : gIo.SearchListGenodigden(value, eventID)) {
							//out.print(g.getNaam() + g.getContactpersoon() + g.getStatus()); 
							if (counter == 1) {
				%><tr class="odd">
					<%
						counter = 2;
								} else {
					%>
					<tr>
						<%
							counter = 1;
									}
						%>

						<td><a
							href="status_details.jsp?genodigdeID=<%out.print(g.getEmail());%>&name=<%out.print(g.getNaam());%>&eventID=<%out.print(eventID);%>">
								<%
									out.print(g.getNaam());
								%>
						</a></td>
						<td>
							<%
								out.print(g.getContactpersoon());
							%>
						</td>
						<td>
							<%
								out.print(g.getEmail());
							%>
						</td>
						<td>
							<%
								out.print(g.getTelefoonnummer());
							%>
						</td>
						
							<%
							String status1 = g.getStatus();
									if (status1.equals("1")) {	status1 = "<td style='color:green'>Geaccepteerd</td>";
									} else if (status1.equals("2")) {status1 = "<td style='color:red'>Afgewezen</td>";
									} else {status1 = "<td>Afwachtend</td>";
									}
									out.print(status1);
						%>
						
					</tr>
					<%
						}
						} else {

							BezoekerIO bIo = new BezoekerIO();

							for (Genodigden g : bIo.naamBezoekers(eventID)) {
								if (counter == 1) {
					%>
				
				<tr class="odd">
					<%
						counter = 2;
								} else {
					%>
					<tr>
						<%
							counter = 1;
									}
						%>

						<td><a
							href="status_details.jsp?genodigdeID=<%out.print(g.getEmail());%>&name=<%out.print(g.getNaam());%>&eventID=<%out.print(eventID);%>">
								<%
									out.print(g.getNaam());
								%>
						</a></td>
						<td>
							<%
								out.print(g.getContactpersoon());
							%>
						</td>
						<td>
							<%
								out.print(g.getEmail());
							%>
						</td>
						<td>
							<%
								out.print(g.getTelefoonnummer());
							%>
						</td>

						<%
							String status1 = g.getStatus();
									if (status1.equals("1")) {	status1 = "<td style='color:green'>Geaccepteerd</td>";
									} else if (status1.equals("2")) {status1 = "<td style='color:red'>Afgewezen</td>";
									} else {status1 = "<td>Afwachtend</td>";
									}
									out.print(status1);
						%>
					</tr>
					<%
						}
						}
					%>
				
			</tbody>
		</table>

	</div>

</body>

</html>